package models

import (
	"kop/modules/battle/configuration"
	"kop/modules/configuration/configuration/attribute"
	"kop/pb"
)

func GetNpc(ID, level int32) (*pb.Captain, error) {

	var npcConf, err = configuration.GetByNPCID(ID)
	if err != nil {
		return nil, err
	}

	attrConf, err := attribute.GetByAttributeID(npcConf.AttributeID + level)
	if err != nil {
		return nil, err
	}

	return &pb.Captain{
		CaptainID: npcConf.ID,
		Level:     level,
		Attribute: &pb.Attribute{
			INT: attrConf.INT,
			COR: attrConf.COR,
			CHR: attrConf.CHR,
		},
		Talents: make([]*pb.Talent, 0), // 预留
		Power:   0,                     // 预留
	}, nil
}
